<?php if (empty($this->data)) : ?>
    <div class="fail-flash">No record found.</div>
<? else : // ถ้ามีข้อมูล ?>
<?php $paginator->options(array('update' => 'divPopUpProductPaginate', 'indicator' => 'indicator')); ?>
<?php echo $this->element('dataCaptionLimit', array('update' => 'divPopUpProductPaginate', 'action' => 'popup_paginate')); ?>
<?php $cur = $paginator->counter(array('format' => '%start%')); ?>
        <table class="data">
            <thead>
                <tr>
                    <th class="no"><?php echo $paginator->sort('No', 'Product.id'); ?></th>
                    <th width="130px"><?php echo $paginator->sort('Vendor Part no', 'Product.supplier_part_no'); ?></th>
                    <th><?php echo $paginator->sort('Category', 'Category.id'); ?></th>
                    <th><?php echo $paginator->sort('Brand', 'Brand.name'); ?></th>
                    <th><?php echo $paginator->sort('Title', 'Product.title'); ?></th>
                    <th><?php echo $paginator->sort('Model', 'Product.model'); ?></th>
                    <th>Price</th>
                    <th class="action">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
        <?php foreach ($this->data as $key => $data): ?>
        <?php
            $tableCell = array();
            $tableCell[] = $cur++;
            $tableCell[] = $data['Product']['supplier_part_no'];
            $tableCell[] = $data['Category']['name'];
            $tableCell[] = $data['Brand']['name'];
            $tableCell[] = $html->tag('span', $data['Product']['title']);
            $tableCell[] = $html->tag('span', $data['Product']['model']);
            $tableCell[] = $html->tag('div', number_format($data['CustProductSite'][0]['price'], 2), array('class' => 'text-right'));
            $tableCell[] = $html->link($html->image('icon/edit.png'), '#', array('onclick' => "popup_click('{$data['Product']['supplier_part_no']}')", 'title' => 'Select'), null, false);
            echo $html->tableCells($tableCell, array('class' => 'odd-cell'), array('class' => 'even-cell'));
        ?>
        <?php endforeach; ?>
        </tbody>
    </table>
    <?php echo $this->element('paging'); ?>
<? endif; ?>